package com.example.designPatterns.observer;

/**
 * @Title: Observer
 * @Description: TODO
 * @Date 2019/8/8 17:25
 */
public class ObserverTest {


    public static void main(String[] args) {


        WechatServer server = new WechatServer();

        Observer userZhang = new User("ZhangSan");
        Observer userLi = new User("LiSi");
        Observer userWang = new User("WangWu");

        server.registerObserver(userZhang);
        server.registerObserver(userLi);
        server.registerObserver(userWang);
        server.sendMsg("PHP是世界上最好用的语言！");

        System.out.println("----------------------------------------------");
        server.removeObserver(userZhang);
        server.sendMsg("JAVA是世界上最好用的语言！");
    }

}
